<?php
try{
	$invoice = Invoice::getInvoiceById($_GET['invoiceId']);
	if($invoice['notNew'] == 1){
		var_dump($invoice);
		throw new Exception("This invoice id {$_GET['invoiceId']} not new");
	}
	if(Invoice::edit($_GET['invoiceId'], array('status'=> 1))){
		echo "Active invoice id {$_GET['invoiceId']} ให้ใช้งานได้แล้ว";
	}
}
catch(Exception $ex){
	Log::error($ex->getMessage());
	View::display('error', array('message'=> $ex->getMessage()));
}